package com.hrm.controller.cam;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractCommandController;

import com.hrm.model.dto.cam.CamViewDTO;
import com.hrm.model.service.CamService;

public class SearchCam extends AbstractCommandController {
	private CamService camService;
		
	public void setCamService(CamService camService) {
		this.camService = camService;
	}

	
	@Override
	protected ModelAndView handle(HttpServletRequest arg0,
			HttpServletResponse arg1, Object arg2, BindException arg3)
			throws Exception {
				
		CamViewDTO dto = new CamViewDTO();
	
		dto = (CamViewDTO)arg2;

		List<CamViewDTO> camlist = camService.getAllCam(dto);

		

		dto = (CamViewDTO)camService.getAllCam(dto);

		ModelAndView mv = new ModelAndView();
		
		mv.addObject("camlist", camlist);
		mv.setViewName("detailCam");

		
		return mv;
	}

}
